<?php 
echo $html->css('start/jquery-ui-1.8.2.custom');
echo $javascript->link('jquery-ui-1.8.2.custom.min');
echo $html->css ( 'tab' );
echo $html->css ( 'jquery-validate/css/screen' );
?>
<script type="text/javascript">
//Form验证
$(document).ready(function() {
	 $.validator.setDefaults({       
		 submitHandler: function(form) {    
		  form.submit();    
		}       
	});
});
</script>
<script type="text/javascript">
	function editVacation(id) {
		$(".id3").val(id);
		$("#f3").submit();
	}

	function delVacation(id) {
		if(!confirm("确定删除?")) {
			return false;
		}
		$(".ids").val(id);
		$("#f2").submit();
	}

	$(function(){
		$(".datepickerSpan :input").datepicker({
			inline: true
		});
		 $('.datepickerSpan :input').datepicker('option', {dateFormat: "yy-mm-dd"});
		 $('.datepickerSpan :input').datepicker( "option", "closeText", 'X' );
	});

	$(document).ready(function(){
		
		$("#btnajaxAdd").click(function(){
			var n=$("#ho1").val();
			$(".ho").val(n);
			var s=$("#ho2").val();
			$(".ho1").val(s);
			var e=$("#ho3").val();
			$(".ho2").val(e);
			// validate signup form on keyup and submit
				$("#f1").validate({
					rules: {
						name:{
							required: true,alowsome: true,stringMinLength:0,stringMaxLength:20
						},
						startDate:{
							required: true, dateISO:true
						},
						endDate:{
							required: true, dateISO:true,endDate: $(".ho1").val()
						}
					},
					messages: {
						name:{
						required:  "请输入假期名称",stringMinLength:"假期名称长度必须大于0个字符",stringMaxLength:"假期名称长度必须小于20个字符"
							
						},
						startDate:{
							required: "请输入假期开始时间"
						},
						endDate:{
							required: "请输入假期结束时间"
						}
					},
					//设置验证触发事件 
					focusInvalid: false, 
					onkeyup: false, 
					//设置错误信息提示DOM  
					errorPlacement: function(error, element) { 
					error.appendTo( element.parent()); 
					}
				});
			$("#f1").submit();
			});
});
</script>

<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Systemconfigs');//一级目录
										   echo '>';echo __('Personal Office');//二级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('legalholidays',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->

<form action="<?php echo ROOT_WEB_PATH; ?>/systemconfigs/addlegalholiday" method="post" id="f1">
<input type="hidden" name="name" class="ho"></input>
<input type="hidden" name="startDate" class="ho1"></input>
<input type="hidden" name="endDate" class="ho2"></input>
</form>
<form action="<?php echo ROOT_WEB_PATH; ?>/systemconfigs/delSomelegalholiday" id="f2" method="post">
<input type="hidden" name="ids" class="ids"></input>
</form>
<form action="<?php echo ROOT_WEB_PATH; ?>/systemconfigs/editlegalholiday" id="f3" method="post">
<input type="hidden" name="id" class="id3"></input>
</form>
 <!-- 当前位置-->
<?php  echo $form->create('del',array('action'=>'addholidaytype','type'=> 'post'));?>
<?php  echo $form->hidden('delStr',array('name'=>'salaryareaid','id'=>'delStr'));?>

<div id="nav1" style="width:28%;margin-left:200px;">
<fieldset><legend><?php __('legalholidays');?></legend>
		<table width="98%" cellspacing="0" cellpadding="0" border="0" >
			<tr>
				<td width="90px"><span class="searchcharstyle"><?php __('legalholidaysname'); ?>：</span>
				</td>
				<td>
				<input type="text" name="name" id="ho1"></input>
				</td>
			</tr>
			<tr>
			<td width="90px"><span class="searchcharstyle"><?php __('StartUseTime'); ?>：</span>
				</td>
				<td>
					<span class="datepickerSpan"><input type='text' id="ho2" name="start"/></span>
				</td>
			</tr>
			<tr>
			<td width="90px"><span class="searchcharstyle"><?php __('EndUseTime'); ?>：</span>
				</td>
				<td>
					<span class="datepickerSpan"><input type='text' id="ho3" name="end"/></span>
				</td>
			</tr>
			<tr>
				<td rowspan="2">
					<a><?php echo $form->button('确定',array('type'=>'button','class'=>'oksubmit',"id"=>"btnajaxAdd","class"=>"btn2"))?></a>
					 <!--添加 -->
				</td>
			</tr>
		</table>
</fieldset>
</div>

 <!-- 法定假日列表 -->
<div id="nav1" style="width:65%;margin-left:200px;">
<table width="100%" cellpadding="0" cellspacing="0" class="tab1">
	<tr>
		<th ><?php echo __('legalholidaysname');?></th>
		<th ><?php echo __('StartUseTime');?></th>
		<th ><?php echo __('EndUseTime');?></th>
		<th width="80px">编辑</th>
		<th width="80px">删除</th>
	</tr>
	<!-- Here's where we loop through our $Notes array, printing out post info --> 
	
	<?php 
	foreach ($result as $row): 
	?>
		<tr class=normal onmouseover='this.className= "over " '
			 onmouseup='this.className= "over " '
			 onmouseout='this.className= "normal " '>
			<td title="<?php echo $row['Legalholiday']['name']; ?>"><?php echo $row['Legalholiday']['name']; ?></td>
			<td><?php echo $row['Legalholiday']['startDate']; ?></td>
			<td><?php echo $row['Legalholiday']['endDate']; ?></td>
			<td><a><?php echo $html->image('edit.gif', array('alt' =>  __('Edit', true),'border'=>'0','onclick'=>"editVacation({$row['Legalholiday']['id']});"));?></a></td>
			<td><a><?php echo $html->image('delete.gif', array('alt' =>  __('Delete', true),'border'=>'0','onclick'=>"delVacation({$row['Legalholiday']['id']});"));?></a></td>
		</tr> 
	<?php endforeach; ?>
</table>
</div>
<!-- 法定假日列表-->

<?php echo $form->end();?>